This program, written in Python, prompts the user to input the base and the height of a parallelogram.
It then calculates the area using the standard formula—multiplying the base by the height—and displays the result.
It’s styled and structured for smooth integration into a webpage using the expected HTML format.
base = float(input("Please enter the base of the parallelogram: "))
height = float(input("Please enter the height of the parallelogram: "))
area = base * height
print("The area of the parallelogram is:", area)
Please enter the base of the parallelogram: 6
Please enter the height of the parallelogram: 4
The area of the parallelogram is: 24.0
In this script:
- The input()
function collects user input.
- The values are converted to decimals using float()
to ensure accurate calculation.
- The formula base × height
is applied using the *
operator.
- The final result is displayed using the print()
function.